home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
A-Monthly Disks
/
(c)abm2.d64
/
hi source
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-04
|
10KB
|
669 lines
5 OPEN4,4,7
10 SYS700
20 .OPT P4
30 *= $C7(null)0
40 FFD2 =$FFD2
50 GETIN =$FFE4
60 BASE =$A000
70 JMP START
80 LCOUNT =*
90 .BYTE 0:EOF =*:.BYTE 0,0
100 TEMP =*
110 .BYTE 0
120 COL =*
130 .BYTE 3
140 FADE =*
150 .BYTE 15,15,12,11,0
160 PRETTY =*
170 .BYTE 0,0
180 MENU =*
190 .ASC "[195][210][211][210] UP/DOWN [159]PAGE [195][159] COLOR [209][159] EXIT":.BYTE 0
200 PRLEN =*:.BYTE 0,0
210 PRLOC =*:.BYTE 0,0
220 PAGE =*:.BYTE 0
230 CURPAGE =*:.BYTE 0
240 BORDER =*:.BYTE 0
250 BACKGR =*:.BYTE 0
260 START JSR $AEFD
270 JSR $AD9E
280 JSR $B6A3
290 LDX $22
300 LDY $23
310 JSR $FFBD
320 LOADFILE LDA #1
330 LDX #8
340 LDY #0
350 JSR $FFBA
360 LDA #0
370 LDX #<BASE
380 LDY #>BASE
390 JSR $FFD5
400 STX EOF
410 STY EOF+1
420 STORZERO STX 251
430 STY 252
440 LDY #0
450 TYA
460 STA (251),Y
470 LDA 53280
480 STA BORDER
490 LDA 53281
500 STA BACKGR
510 LDY #0
520 STY 53280
530 STY 53281
540 JSR $AEFD
550 JSR $AD9E
560 JSR $B6A3
570 LDX $22:STX PRLOC
580 LDY $23:STY PRLOC+1
590 LDX #23
600 STA PRLEN
610 LSR
620 STA PRLEN+1
630 LDA #20
640 SEC
650 SBC PRLEN+1
660 STA PRLEN+1
670 JSR FIGUREIT
680 LDA 1
690 ORA #1
700 STA 1
710 JSR VIDEOIN
720 LDA #"[147]"
730 JSR $FFD2
740 LDA #1
750 STA 646
760 LDA #"[162]"
770 LDY #39
780 TOPLINE JSR $FFD2
790 DEY
800 BPL TOPLINE
810 LDA #3
820 STA 199
830 STA 646
840 LDA #32
850 LDY #119
860 LINE2 JSR $FFD2
870 DEY
880 BPL LINE2
890 LDA #0
900 STA CURPAGE
910 STA 199
920 LDA #11
930 STA 646
940 LDA #"[184]"
950 LDY #39
960 LINE3 JSR $FFD2
970 DEY
980 BPL LINE3
990 LDA #6
1000 STA 646
1010 LDA #"[176]"
1020 JSR $FFD2
1030 LDY #37
1040 LDA #"[192]"
1050 SIGH JSR $FFD2
1060 DEY
1070 BPL SIGH
1080 LDA #"[174]"
1090 JSR $FFD2
1100 LDX #15
1110 MAINAREA LDY #37
1120 LDA #"[221]"
1130 JSR $FFD2
1140 LDA #3
1150 STA 646
1160 LDA #32
1170 MA1 JSR $FFD2
1180 DEY
1190 BPL MA1
1200 LDA #6
1210 STA 646
1220 LDA #"[221]"
1230 JSR $FFD2
1240 DEX
1250 BPL MAINAREA
1260 LDA #"[173]"
1270 JSR $FFD2
1280 LDA #"[192]"
1290 LDY #37
1300 MA3 JSR $FFD2
1310 DEY
1320 BPL MA3
1330 LDA #"[189]"
1340 JSR $FFD2
1350 LINKS LDY #25
1360 LINELINK LDA 217,Y
1370 ORA #128
1380 STA 217,Y
1390 DEY
1400 BPL LINELINK
1410 STX 251
1420 STY 252
1430 LDY #3:LDX #23
1440 CLC
1450 JSR $FFF0
1460 LDY #0
1470 SMENU LDA MENU,Y
1480 BEQ SPRETTY
1490 JSR $FFD2
1500 INY
1510 JMP SMENU
1520 SPRETTY LDX #3
1530 STX 199
1540 STX 646
1550 LDX #2
1560 LDY PRLEN+1
1570 CLC:JSR $FFF0
1580 LDA PRLOC
1590 STA 251
1600 LDA PRLOC+1
1610 STA 252
1620 LDY #0
1630 SHOWPRET LDA (251),Y
1640 JSR $FFD2
1650 INY
1660 CPY PRLEN
1670 BNE SHOWPRET
1680 MAIN LDA #<BASE
1690 STA 251
1700 LDA #>BASE
1710 STA 252
1720 SHOWPAGE LDX #6
1730 LDY #1
1740 CLC
1750 JSR $FFF0
1760 LDA #0
1770 STA 646
1780 LDY #0
1790 STY LCOUNT
1800 STY 199
1810 GETIT LDA 1
1820 AND #254
1830 STA 1
1840 SEI
1850 GETDATA LDA (251),Y
1860 BEQ INTERUPT
1870 CMP #13
1880 BEQ ITS13
1890 JMP PRINT
1900 ITS13 JSR CARRIAGE
1910 LDA LCOUNT
1920 CMP #16
1930 BNE GETDATA
1940 INTERUPT CLI
1950 LDA 1
1960 ORA #1
1970 STA 1
1980 JSR FADEIN
1990 JSR PRINPAGE
2000 SCANKEY JSR GETIN
2010 CMP #0
2020 BEQ SCANKEY
2030 CMP #""
2040 BNE CUP
2050 JSR FLIPUP
2060 JSR FADEOUT
2070 JMP SHOWPAGE
2080 CUP CMP #"[145]"
2090 BNE CHCOL
2100 JSR FLIPDOWN
2110 JSR FADEOUT
2120 JMP SHOWPAGE
2130 CHCOL CMP #"C"
2140 BNE CHHOME
2150 JSR COLOR
2160 JMP SC_NKEY
2170 CHHOME CMP #""
2180 BNE CHSHIFT
2190 JSR FADEOUT
2200 LDA #1
2210 STA CURPAGE:JSR FLIPDOWN
2220 JMP SHOWPAGE
2230 CHSHIFT CMP #"[147]"
2240 BNE CHQUIT
2250 LDX PAGE
2260 STX CURPAGE
2270 JSR FADEOUT
2280 JSR FLIPUP
2290 JMP SHOWPAGE
2300 CHQUIT CMP #"Q"
2310 BNE CHPRT
2320 JMP QUIT
2330 CHPRT CMP #"P"
2340 BNE AHWELL
2350 JSR PROMPT
2360 JSR CLEAR
2370 JMP LINKS
2380 AHWELL JMP SCANKEY
2390 PRINT JSR $FFD2
2400 JSR BUMP
2410 JMP GETIT
2420 QUIT LDA 1
2430 ORA #1
2440 STA 1
2450 JSR VIDEOOUT
2460 RTS
2470 CARRIAGE JSR $FFD2
2480 LDA #""
2490 JSR BUMP
2500 JSR $FFD2
2510 INC LCOUNT
2520 RTS
2530 COLOR INC COL
2540 LDA COL
2550 AND #15
2560 STA COL:STA 646
2570 CMP #0
2580 BEQ COLOR
2590 CWAIT LDA 53265
2600 BPL CWAIT
2610 LDY #37
2620 LDA COL
2630 WCOLOR STA 1265+54272,Y
2640 STA 1305+54272,Y
2650 STA 1345+54272,Y
2660 STA 1385+54272,Y
2670 STA 1425+54272,Y
2680 STA 1465+54272,Y
2690 STA 1505+54272,Y
2700 STA 1545+54272,Y
2710 STA 1585+54272,Y
2720 STA 1625+54272,Y
2730 STA 1665+54272,Y
2740 STA 1705+54272,Y
2750 STA 1745+54272,Y
2760 STA 1785+54272,Y
2770 STA 1825+54272,Y
2780 STA 1865+54272,Y
2790 DEY
2800 BPL WCOLOR
2810 RTS
2820 BUMP INC 251
2830 BEQ BUMP2
2840 RTS
2850 BUMP2 INC 252
2860 RTS
2870 CLEAR LDA 53265
2880 BPL CLEAR
2890 LDY #37
2900 LDA #32
2910 WIPE STA 1265,Y
2920 STA 1305,Y
2930 STA 1345,Y
2940 STA 1385,Y
2950 STA 1425,Y
2960 STA 1465,Y
2970 STA 1505,Y
2980 STA 1545,Y
2990 STA 1585,Y
3000 STA 1625,Y
3010 STA 1665,Y
3020 STA 1705,Y
3030 STA 1745,Y
3040 STA 1785,Y
3050 STA 1825,Y
3060 STA 1865,Y
3070 DEY
3080 BPL WIPE
3090 RTS
3100 FIGUREIT LDA 1
3110 AND #254
3120 STA 1
3130 LDA #<BASE
3140 STA 251:STA PTABLE
3150 LDA #>BASE
3160 STA 252:STA PTABLE+1
3170 LDY #0
3180 LDX #0
3190 STX PAGE
3200 APAGE LDA (251),Y
3210 BNE CKRT
3220 RTS
3230 CKRT CMP #13
3240 BNE INCPAGE
3250 JSR FOUND
3260 INCPAGE INC 251
3270 BEQ BPAGE
3280 JMP APAGE
3290 BPAGE INC 252
3300 JMP APAGE
3310 FOUND INX
3320 CPX #15
3330 BNE FOUNDOUT
3340 LDX #0
3350 INC PAGE
3360 INC 251
3370 BNE CPAGE
3380 INC 252
3390 CPAGE LDA PAGE
3400 ASL
3410 TAX
3420 LDA 251
3430 STA PTABLE,X
3440 LDA 252
3450 INX
3460 STA PTABLE,X
3470 LDX #0
3480 FOUNDOUT RTS
3490 FLIPUP LDA CURPAGE
3500 CMP PAGE
3510 BNE GHEAD
3520 JMP CHPAGE
3530 GHEAD INC CURPAGE
3540 CHPAGE LDA CURPAGE
3550 ASL
3560 TAX
3570 LDA PTABLE,X
3580 STA 251
3590 INX
3600 LDA PTABLE,X
3610 STA 252
3620 RTS
3630 FLIPDOWN LDA CURPAGE
3640 BNE SOKAY
3650 JMP CHPAGE
3660 SOKAY DEC CURPAGE
3670 JMP CHPAGE
3680 FADEOUT LDA COL
3690 STA TEMP
3700 SEI
3710 LDX #0
3720 FLOOP LDA FADE,X
3730 STA COL
3740 JSR CWAIT
3750 INX
3760 CPX #5
3770 BNE FLOOP
3780 FOUT JSR CLEAR
3790 LDA TEMP
3800 STA COL
3810 CLI:RTS
3820 FADEIN LDA COL
3830 STA TEMP
3840 LDX #5
3850 SEI
3860 FILOOP LDA FADE,X
3870 STA COL
3880 JSR CWAIT
3890 DEX
3900 BNE FILOOP
3910 LDA TEMP
3920 STA COL
3930 JSR CWAIT
3940 CLI:RTS
3950 PRINPAGE LDX #24
3960 LDY #17
3970 CLC
3980 JSR $FFF0
3990 LDA #12
4000 STA 646
4010 LDX CURPAGE
4020 INX
4030 LDA #0
4040 STA 199
4050 CLC
4060 JSR $BDCD
4070 LDA #" "
4080 JSR $FFD2
4090 LDA #"O"
4100 JSR $FFD2
4110 LDA #"F"
4120 JSR $FFD2
4130 LDA #" "
4140 JSR $FFD2
4150 LDA #0
4160 LDX PAGE
4170 INX
4180 JSR $BDCD
4190 LDA #" "
4200 JSR $FFD2
4210 LDA #"[145]"
4220 JMP $FFD2
4230 VIDEOIN LDA #0
4240 STA 251
4250 STA 253
4260 LDA #>1024
4270 STA 252
4280 LDA #>$E000
4290 STA 254
4300 JSR COPY
4310 LDA #>$D800
4320 STA 252
4330 LDA #>$E400
4340 STA 254
4350 JSR COPY
4360 RTS
4370 VIDEOOUT LDA #0
4380 STA 251
4390 STA 253
4400 LDA #>$E000
4410 STA 252
4420 LDA #>$0400
4430 STA 254
4440 JSR COPY
4450 LDA #>$E400
4460 STA 252
4470 LDA #>$D800
4480 STA 254
4490 JSR COPY
4500 LDA BORDER
4510 STA 53280
4520 LDA BACKGR
4530 STA 53281
4540 RTS
4550 COPY LDX #3
4560 LDY #0
4570 SEI
4580 LDA 1
4590 AND #253
4600 STA 1
4610 COPYA LDA (251),Y
4620 STA (253),Y
4630 INY
4640 BNE COPYA
4650 INC 252
4660 INC 254
4670 DEX
4680 BPL COPYA
4690 LDA 1
4700 ORA #2
4710 STA 1
4720 CLI
4730 RTS
4740 PRINTOUT JSR OPENPTR
4750 LDA #4
4760 JSR $FFC3 ;CLOSE FILE
4770 JSR $FFB7 ;READST
4780 BPL (null)AHEAD
4790 FLASH INC 53281
4800 LDA 197
4810 CMP #64
4820 BNE FLASH
4830 LDA #0
4840 STA 53281
4850 RTS
4860 (null)AHEAD JSR OPENPTR
4870 LDX #4 ; FILE NUMBER
4880 JSR $FFC9 ; OUTPUT TO FILE #4
4890 LDA #1
4900 STA POS
4910 STA WORDLEN
4920 STA ENDPFLAG
4930 STA RETCOUNT
4940 INC RETCOUNT
4950 LDA #" "
4960 LDX #4
4970 STX LINE
4980 JSR REPEAT
4990 JSR LEFTMRGN ;POSITION PRINTER
5000 JSR SETPRT
5010 HERE(null)ES JSR FINDWORD ;FIND A WORD
5020 JSR PRINTWRD ;PRINT THE WORD
5030 JSR ADVCNTR ;ADVANCE HI/LO POINTER
5040 LDX 197
5050 CPX #10
5060 BEQ FORMFEED
5070 LDX ENDPFLAG
5080 BPL HERE(null)ES;IF NOT END THEN LOOP
5090 FORMFEED LDA #13
5100 JSR $FFD2
5110 INC LINE
5120 LDA LINE
5130 CMP #69
5140 BCC FORMFEED
5150 LDA #4
5160 JSR $FFC3:DEC 154
5170 RTS
5180 OPENPTR LDA #4; FILE NO
5190 LDX #4; DEVICE NO
5200 LDY #7
5210 JSR $FFBA ;SETLFS
5220 LDA #0
5230 JSR $FFBD
5240 JSR $FFC0 ;OPEN
5250 RTS
5260 REPEAT JSR $FFD2
5270 DEX
5280 BNE REPEAT
5290 RTS
5300 LEFTMRGN LDA #13
5310 JSR $FFD2
5320 LDX #10:STX POS
5330 LDA #" "
5340 JSR REPEAT
5350 INC LINE
5360 LDX LINE
5370 CPX #61
5380 BNE NOTYET
5390 LDX #10
5400 LDA #13
5410 NPAGE JSR $FFD2
5420 DEX
5430 BNE NPAGE
5440 LDA #5
5450 STA LINE
5460 LDA #"[160]"
5470 LDX #10
5480 STX POS
5490 JSR REPEAT
5500 NOTYET RTS
5510 SETPRT LDA #<BASE
5520 STA 249
5530 LDA #>BASE
5540 STA 250
5550 RTS
5560 FINDWORD LDY #0
5561 LDA 1
5562 AND #254
5563 STA 1
5570 FW1 LDA (249),Y
5580 BNE NONZERO
5590 LDX #129
5600 STX ENDPFLAG
5610 NONZERO STA WORDBUF,Y
5620 NOTRET AND #95 ;32 OR 160 WILL ZERO
5630 BEQ AHA ;FOUND A SPACE OR SHIFT
5640 CPY #41
5650 BEQ AHA ;WORD BUFFER IS FULL
5660 INY
5670 BNE FW1
5680 AHA CLC
5681 LDA 1
5682 ORA #1
5683 STA 1
5690 TYA
5700 STA WORDLEN
5710 ADC POS
5720 CMP #76 ;RIGHT MARGIN
5730 BCC SHORT
5740 JSR LEFTMRGN
5750 SHORT RTS
5760 PRINTWRD LDY #0:INC WORDLEN
5770 PTWD1 LDA WORDBUF,Y
5780 INY
5790 LDX WORDBUF,Y
5800 DEY
5810 STX NCHAR
5820 JSR CHECKRT
5830 CMP #0
5840 BEQ PTWD2
5850 JSR $FFD2
5860 INC POS
5870 PTWD2 INY
5880 CPY WORDLEN
5890 BNE PTWD1
5900 DEC WORDLEN
5910 RTS
5920 RTS
5930 INCPRT INC 249
5940 BNE INPRTOUT
5950 INC 250
5960 INPRTOUT RTS
5970 DECPRT DEC 249
5980 BNE DEPRTOUT
5990 DEC 250
6000 DEPRTOUT RTS
6010 ZERORET LDX #2
6020 STX RETCOUNT
6030 RTS
6040 CHECKRT CMP #13
6050 BEQ CHECKRT1
6060 JSR ZERORET
6070 RTS
6080 CHECKRT1 LDX NCHAR
6090 CPX #32
6100 BEQ CHECKSP2
6110 CPX #13
6120 BEQ CHECKRT3
6130 CHECKRT2 DEC RETCOUNT
6140 BEQ CHECKRT3
6150 LDA #" "
6160 RTS
6170 CHECKRT3 JSR ZERORET
6180 JSR LEFTMRGN
6190 LDA #0
6200 RTS
6210 CHECKSP2 JSR LEFTMRGN
6220 LDA #" "
6230 RTS
6240 ADVCNTR LDY WORDLEN
6250 ADVCNTR1 JSR INCPRT
6260 DEY
6270 BPL ADVCNTR1
6280 RTS
6290 PROMPT LDX #23
6300 LDY #0
6310 CLC
6320 JSR $FFF0
6330 LDY #0
6340 PTPROMPT LDA PROMPTA,Y
6350 JSR $FFD2
6360 INY
6370 CPY #46
6380 BNE PTPROMPT
6390 SPWAIT JSR $FFE4
6400 BEQ SPWAIT
6410 CMP #" "
6420 BNE SPWAIT1
6430 JSR PRINTOUT
6440 SPWAIT1 RTS
6450 POS =*
6460 .BYTE 0
6470 LINE =*
6480 .BYTE 0
6490 WORDLEN =*
6500 .BYTE 0
6510 WORDBUF =*
6520 .ASC "THIS IS THE PRINT BUFFER. IT'S 41 BYTES."
6530 RETCOUNT =*
6540 .BYTE 1
6550 ENDPFLAG =*
6560 .BYTE 1
6570 NCHAR =*
6580 .BYTE 1
6590 PROMPTA =*
6600 .ASC " [211][208][193][195][197] [146][159] TO PRINT [193] [146][159] [193]BORT "
6610 PTABLE =*